﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace DAL
{
    /// <summary>
    ///DBManager 的摘要说明
    /// </summary>
    public class DBManager
    {
        private static string strCon;

        private static string StrCon
        {
            get
            {
                if (string.IsNullOrEmpty(strCon))
                {
                    strCon = System.Configuration.ConfigurationManager.ConnectionStrings["CMSEntities"].ConnectionString;
                }
                return strCon;
            }
        }

        private static string cpdb;

        public static string Cpdb
        {
            get
            {
                if (string.IsNullOrEmpty(cpdb))
                {
                    cpdb = System.Configuration.ConfigurationManager.ConnectionStrings["cpdb"].ConnectionString;
                }
                return cpdb;
            }
        }

        private static string gaInfoStrCon;
        public static string GaInfoStrCon
        {
            get
            {
                if (string.IsNullOrEmpty(gaInfoStrCon))
                {
                    gaInfoStrCon = System.Configuration.ConfigurationManager.ConnectionStrings["strConn3"].ConnectionString;
                }
                return gaInfoStrCon;
            }
        }

        private static string bbs;

        public static string BBS
        {
            get
            {
                if (string.IsNullOrEmpty(bbs))
                {
                    bbs = System.Configuration.ConfigurationManager.ConnectionStrings["bbs"].ConnectionString;
                }
                return bbs;
            }
        }

        public static CMSModel.CMSEntities GetCmsEmtity()
        {
           return new CMSModel.CMSEntities(StrCon);
        }


        private static string mainQuoteStr;

        public static string MainQuoteStr
        {
            get
            {
                if (string.IsNullOrEmpty(mainQuoteStr))
                {
                    mainQuoteStr = System.Configuration.ConfigurationManager.ConnectionStrings["MainQuoteDBEntities"].ConnectionString;
                }
                return mainQuoteStr;
            }
        }
        public static MainQuoteDBModel.MainQuoteDBEntities GetMainQuoteDbEntities()
        {
            return new MainQuoteDBModel.MainQuoteDBEntities(MainQuoteStr);
        }

        public static string FCDB
        {
            get
            {
                return System.Configuration.ConfigurationManager.ConnectionStrings["fcdb"].ConnectionString;
            }
        }

        /// <summary>
        /// 股票医生
        /// </summary>
        public static string GPYS
        {
            get
            {
                return System.Configuration.ConfigurationManager.ConnectionStrings["GPYS"].ConnectionString;
            }
        }

        /// <summary>
        /// 网站广告
        /// </summary>
        private static string webSite;
        public static string WebSite
        {
            get {
                if (string.IsNullOrEmpty(webSite))
                {
                    //webSite = System.Configuration.ConfigurationManager.ConnectionStrings["WebSite"].ConnectionString;
                    webSite = "Data Source=192.168.10.252;Initial Catalog=emweb_new;Persist Security Info=True;User ID=sa;Password=emoney.cn";
                }
                return webSite;
            }
        }


        private static string strGDZG;

        private static string StrGDZG
        {
            get
            {
                if (string.IsNullOrEmpty(strGDZG))
                {
                    strGDZG = System.Configuration.ConfigurationManager.ConnectionStrings["TemporaryEntities"].ConnectionString;
                }
                return strGDZG;
            }
        }

        public static TemporaryModel.TemporaryEntities GetTempEmtity()
        {
            return new TemporaryModel.TemporaryEntities(StrGDZG);
        }
    }
}